package com.lch.thread.juc;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author: liuchenhui
 * @create: 2019-05-26 14:22
 **/
public class ThreadPoolTest {

    public static void main(String[] args) {
        ExecutorService executorService;

        executorService = Executors.newFixedThreadPool(3);

        executorService = Executors.newSingleThreadExecutor();

        executorService = Executors.newCachedThreadPool();

        executorService = Executors.newScheduledThreadPool(10);
        for (int i = 0; i < 10; i++) {
            final int a = i;
            executorService.execute(() -> System.out.println(Thread.currentThread().getName() + "|" + a));
        }
        executorService.shutdown();
    }
}